package com.woniuxy.springsecurity.entity;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * @Author author
 * @Create 2023-09-13 15:52
 */
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder
public class ResponseResult<T> {
    private Integer code;
    private String msg;
    private T data;

    public static final ResponseResult<Void> SUCCESS
            =ResponseResult.<Void>builder().code(200).msg("success").build();

    public static final ResponseResult<Void> FAILED
            =ResponseResult.<Void>builder().code(500).msg("failed").build();

    public static ResponseResult<Void> ok(){
       return ResponseResult.<Void>builder().code(200).msg("success").build();
    }

    public static<T>  ResponseResult<T> ok(T data){
        return ResponseResult.<T>builder().code(200).msg("success").data(data).build();
    }

}
